﻿using System;

namespace SpiritEngine
{
    // NOTE: This class has an 'A' prepended to it's name to show that
    //       it is an abstract class, and therefore cannot itself be
    //       instantiated.

    // The base input device class.  Other input device types will
    // inherit from it.  The <T> generic follows the class name to
    // specify what type of input device state it manages.  (MouseState, KeyboardState, etc.)
    public abstract class AC_InputDevice<T> : AComponent
    {
        // MEMBER VARIABLES
        // ------------------------------------------------------------------------------------------------------------------------



        // CONSTRUCTORS
        // ------------------------------------------------------------------------------------------------------------------------



        // PRIVATE/PROTECTED METHODS
        // ------------------------------------------------------------------------------------------------------------------------



        // METHODS
        // ------------------------------------------------------------------------------------------------------------------------



        // DEBUG METHODS
        // ------------------------------------------------------------------------------------------------------------------------

#if (DEBUG)
        // put all debug methods in here...
#endif



        // PROPERTIES
        // ------------------------------------------------------------------------------------------------------------------------

        // State property
        public abstract T State
        {
            get;
        } // end property State



        // EVENTS
        // ------------------------------------------------------------------------------------------------------------------------





    } // end class InputDevice



    // OTHER STUFF
    // ------------------------------------------------------------------------------------------------------------------------

    // An input device event argument class that can handle events
    // for several types of input devices.  "O" specifies what type
    // of object the event was triggered by (Key, Button,
    // MouseButton, etc).  "S" specifies the type of state the
    // event provides (MoudeStte, KeyboardState, etc.)
    public class InputDeviceEventArgs<O, S> : EventArgs
    {
        // MEMBER VARIABLES
        // ------------------------------------------------------------------------------------------------------------------------

        // The object of type O that triggered the event
        public O Object;

        // The input device that manages the state of type S that
        // owns the triggered object
        public AC_InputDevice<S> Device;

        // The state of the input device of type S that was triggered
        public S State;



        // CONSTRUCTORS
        // ------------------------------------------------------------------------------------------------------------------------

        // Constructor takes the triggered object and input device
        public InputDeviceEventArgs(O Object, AC_InputDevice<S> Device)
        {
            this.Object = Object;
            this.Device = Device;
            this.State = ((AC_InputDevice<S>) Device).State;

        } // end InputDeviceEventArgs.InputDeviceEventArgs(Object, InputDeviceEventArgs<S>)


        // METHODS
        // ------------------------------------------------------------------------------------------------------------------------



        // PROPERTIES
        // ------------------------------------------------------------------------------------------------------------------------

        

    } // end class InputDeviceEventArgs



    // EVENT HANDLERS
    // ------------------------------------------------------------------------------------------------------------------------
  
    public delegate void InputEventHandler<O, S>(object sender, InputDeviceEventArgs<O, S> e);



} // end namespace SpiritEngine
